package edu.office.sessionRepository;

import edu.office.applicationRepository.LogsRepository;
import edu.office.applicationRepository.StudentRepository;
import edu.office.entities.Student;
import edu.office.entities.TeacherAdmin;
import edu.office.entities.User;
import jakarta.inject.Inject;

/**
 *
 * @author hgs
 * @param <T>
 */
public abstract class CommonModelSSRep<T>{

    @Inject
    protected LogsRepository applicationLogsController;
    @Inject
    protected StudentRepository studentController;

    protected T current;

    protected void logs(User user, String recorderinfo, String tableName, String operation) {
        if (user instanceof TeacherAdmin) {
            applicationLogsController.logsInTable(user.getId(),
                    null, recorderinfo, tableName, operation);
        } else if (user instanceof Student) {
            applicationLogsController.logsInTable(null,
                    user.getId(), recorderinfo, tableName, operation);
        }
    }
}
